package com.beans;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: H_tao_X
 * Date: 2022-11-17
 * Time: 0:39
 */

/**
 * 将 User 对象存储到 UserBeans 当中
 */
@Component
public class UserBeans {
    // 公共 Bean
    @Bean        // [注意：只是用一个  @Bean 是无法将对象存储到容器中的]
    public User user1() {
        User user = new User();
        user.setId(1);
        user.setName("张三");
        return user;
    }

//    @Bean
//    public User user2() {
//        User user2 = new User();
//        user2.setId(2);
//        user2.setName("李四");
//        return user2;
//    }
}
